package com.qs.home.ui.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.qs.base.base.BaseMyFragment;
import com.qs.base.router.RouterFragmentPath;
import com.qs.home.BR;
import com.qs.home.R;
import com.qs.home.databinding.HomeFragmentOriginalBinding;
import com.qs.home.entity.TextResultEntity;
import com.qs.home.ui.VM.IdentifyDetailsViewModel;
import com.qs.home.ui.VM.IdentifyResultsItemViewModel;

import java.util.List;

import me.goldze.mvvmhabit.utils.StringUtils;

/**
 * 识别结果原图
 *
 * @Author ltzz
 * @Date 2019/8/20
 */
@Route(path = RouterFragmentPath.Home.ORIGINAL_FRAGMENT)
public class OriginalFragment extends BaseMyFragment<HomeFragmentOriginalBinding, IdentifyDetailsViewModel> {

    //识别结果数据
    @Autowired(name = "textResult")
    TextResultEntity textResult;

    @Override
    protected View titleLayout() {
        return null;
    }

    @Override
    protected boolean statusBarDarkFont() {
        return false;
    }

    @Override
    public int initContentView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return R.layout.home_fragment_original;
    }

    @Override
    public int initVariableId() {
        return BR.viewModel;
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        if (textResult != null) {
            viewModel.textResultOb.set(textResult);
            viewModel.loadImage(binding.riginalImg, textResult.getFilePath());
        }
    }
}
